﻿@namespace BootstrapBlazor.Components
@inherits IdComponentBase

<ul @attributes="@AdditionalAttributes" id="@Id" class="@GetMenuClassString">
    @foreach (var item in Items)
    {
        if (item.Items.Any())
        {
            <li>
                <MenuLink Item="@item" data-bs-toggle="collapse" data-bs-target="@GetTargetIdString(item)" />
                @if (!item.IsDisabled)
                {
                    <SideMenu Items="@item.Items" OnClick="@OnClickItem" Id="@GetTargetId(item)" class="collapse" data-bs-parent="@ParentIdString" />
                }
            </li>
        }
        else
        {
            <li @onclick:stopPropagation @onclick="() => OnClickItem(item)">
                <MenuLink Item="@item" />
            </li>
        }
    }
</ul>
